package edu.uow.devdocs

class Attachment {
	
	static mapping = {
		table 'ATTACHMENT'
		// version is set to false, because this isn't available by default for legacy databases
		version false
		id column:'ATTACHMENT_ID'
		meetingMinutes column:'MEETING_MINUTES_ID'
		issue column:'ISSUE_ID'
		downtimeReport column:'DOWNTIME_REPORT_ID'
		developmentTask column:'DEVELOPMENT_TASK_ID'
		deployment column:'DEPLOYMENT_ID'
		id generator: 'sequence', params:[sequence:'ATTACHMENT_SEQ']
		sort filename:'ASC'
	   }

	byte[] fileContents
	MeetingMinutes meetingMinutes
	// Relation
	Issue issue
	// Relation
	DowntimeReport downtimeReport
	// Relation
	DevelopmentTask developmentTask
	// Relation
	Deployment deployment
	DevelopmentChecklist developmentChecklist
	String filename
	String originalFilename
	Integer filesize
	String contentType
	
	static constraints = {
		meetingMinutes(nullable: true)
		issue(nullable: true)
		downtimeReport(nullable: true)
		developmentTask(nullable: true)
		developmentChecklist(nullable: true)
		deployment(nullable: true)
		fileContents()
		filename(minLength:10)
		contentType(nullable: true)
		filesize(nullable: true)
		originalFilename(nullable: true)
	}
	
}
